package com.yunji.common.model.domain;

import com.yunji.common.base.BaseDelFlagDO;
import com.yunji.common.utils.StringUtils;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Date;

/**
 * 缓存信息
 *
 * @author yunji
 */
@Data
public class SysCacheDO extends BaseDelFlagDO {
    /**
     * 缓存名称
     */
    @ApiModelProperty("缓存名村")
    private String cacheName = "";

    /**
     * 缓存键名
     */
    @ApiModelProperty("缓存键名")
    private String cacheKey = "";

    /**
     * 缓存内容
     */
    @ApiModelProperty("缓存内容")
    private String cacheValue = "";

    /**
     * 备注
     */
    @ApiModelProperty("备注")
    private String remark = "";


    private String createBy;

    private Date createTime;

    private String updateBy;

    private Date updateTime;

    public SysCacheDO() {

    }

    public SysCacheDO(String cacheName, String remark) {
        this.cacheName = cacheName;
        this.remark = remark;
    }

    public SysCacheDO(String cacheName, String cacheKey, String cacheValue) {
        this.cacheName = StringUtils.replace(cacheName, ":", "");
        this.cacheKey = StringUtils.replace(cacheKey, cacheName, "");
        this.cacheValue = cacheValue;
    }
}
